#!usr/bin/env python
# -*- coding:utf-8 _*-
"""
# author: 小菠萝测试笔记
# blog:  https://www.cnblogs.com/poloyy/
# time: 2021/11/1 9:52 下午
# file: redis_utils.py
"""

import redis
from app.config.setting import settings

pool = redis.ConnectionPool(
    host=settings.redis_host, port=settings.redis_port, decode_responses=True
)
my_redis = redis.Redis(connection_pool=pool, decode_responses=True)

# import asyncio
#
#
# async def redis_pool():
#     pool = None
#     print(pool)
#     try:
#         pool = aioredis.ConnectionPool.from_url(
#             "redis://localhost", decode_responses=True
#         )
#         meanings = aioredis.Redis(connection_pool=pool)
#         return meanings
#     finally:
#         await pool.disconnect()
#
# redis = asyncio.run(redis_pool())
# print(type(redis))
# await redis.set("123", "!23")
# print(redis.get("123"))
